<template>
  <router-view/>
  <router-link to="/">首页</router-link>|
   <router-link to="/about">about</router-link>
</template>
<script setup>
import { nextTick,onMounted,onBeforeUnmount } from 'vue'
onMounted(() => {
   nextTick(() => {
     changeScale()
   })
    window.addEventListener('resize', changeScale)
})
const changeScale = () => {
  let targetX = 1920
  let x = document.documentElement.clientWidth
  let scaleX = x / targetX
  //动态缩放
  document.querySelector('#app').setAttribute('style', `transform:scale(${scaleX}`)
}
onBeforeUnmount(() => {
  window.removeEventListener('resize', changeScale)
})

</script>
<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin: 0;
  padding:0;
}

</style>
